﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Runtime.Serialization;

namespace LunchRoller.ViewModels
{
    [DataContract]
    public class PlaceModel:ViewModelBase
    {

        public PlaceModel():base()
        { 
        
        }


        [DataMember] 
        public PropertyContainer<String> _Name
            = new PropertyContainer<String>("Name","");
       
        public String Name
        {
            get { return _Name.Value; }
            set
            {
                if (string.IsNullOrEmpty(value))
                {
                    value = "-";
                } 
                _Name.SetValueAndTryNotify(this, value);
            }
        }




        [DataMember]
        public  PropertyContainer<String> _Description
            = new PropertyContainer<String>("Description", "");
        
        public String Description
        {
            get { return _Description.Value; }
            set { _Description.SetValueAndTryNotify(this, value); }
        }



        public MainViewModel MainViewModel { get {return App.ViewModel; }}



        bool _Chosen = true;
        [DataMember]
        public bool Chosen
        {
            get 
            { 
                return  _Chosen; 
            }
            set {
                _Chosen = value;
                base.RaisePropertyChanged("Chosen"); 
                ChosenVisibility=value?Visibility.Visible:Visibility.Collapsed; 
            }
        }

        Visibility _ChosenVisibility =  Visibility.Collapsed;

        public Visibility ChosenVisibility
        {
            get
            {
                return Chosen? Visibility.Visible:Visibility.Collapsed; ;
            }
           private set
            {
                _ChosenVisibility = value;
                base.RaisePropertyChanged("ChosenVisibility");
            }
        }


        bool _IsAdding = true;

        public bool IsAdding
        {
            get
            {
                return _IsAdding;
            }
            set
            {
                _IsAdding = value;
                base.RaisePropertyChanged("IsAdding");
            }
        }

        public String AddingOrEditingText
        {
            get { return IsAdding ? "添加" : "编辑"; }
        }
        
        
    }
}
